<?php  
class ControllerModuleCurrency extends Controller {
	protected function index() {

		$connection = 'NONSSL';
		if (isset($this->request->get['_route_'])) {
			$route = $this->request->get['_route_'];
			if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
				$connection = 'SSL';
			}
		} else {
			$route = '';
		}
		
		$this->language->load('module/currency');
    	$this->data['text_currency'] = $this->language->get('text_currency');
		
		$this->data['currency_current'] = $this->currency->getCode(); 
		
		$this->data['currencies'] = array();
		$this->load->model('localisation/currency');
		$results = $this->model_localisation_currency->getCurrencies();	
		foreach ($results as $result) {
			if ($result['status']) {
   				$this->data['currencies'][] = array(
					'title'        => $result['title'],
					'code'         => $result['code'],
					'symbol_left'  => $result['symbol_left'],
					'symbol_right' => $result['symbol_right'],
					'image'        => $result['image'],
   					'href'         => $this->url->linkCurrency($result['code'], $route, $connection)				
				);
			}
		}

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/currency.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/currency.tpl';
		} else {
			$this->template = 'default/template/module/currency.tpl';
		}
		
		$this->render();
	}
}
?>